From b4886717f465b86ff532f51d128280c9ad1e7794 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Tue, 1 Nov 2011 16:19:44 +0000 Subject: [PATCH] * Use local context to get messages * Parse 'activeusers-noresult' and 'activeusers-intro' messages --- includes/specials/SpecialActiveusers.php | 47 ++++++++++++------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index 17f4a8b83d..60b3a5d5a5 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -131,13 +131,9 @@ class ActiveUsersPager extends UsersPager { $groups = $lang->commaList( $list ); $item = $lang->specialList( $ulinks, $groups ); - $count = wfMsgExt( 'activeusers-count', - array( 'parsemag' ), - $lang->formatNum( $row->recentedits ), - $userName, - $lang->formatNum( $this->RCMaxAge ) - ); - $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; + $count = $this->msg( 'activeusers-count' )->numParams( $row->recentedits ) + ->params( $userName )->numParams( $this->RCMaxAge )->escaped(); + $blocked = $row->blocked ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : ''; return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" ); } @@ -149,16 +145,19 @@ class ActiveUsersPager extends UsersPager { $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : ''; $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag - $out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n"; + $out .= Xml::fieldset( $this->msg( 'activeusers' )->text() ) . "\n"; $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; - $out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '
';# Username field + $out .= Xml::inputLabel( $this->msg( 'activeusers-from' )->text(), + 'username', 'offset', 20, $this->requestedUser ) . '
';# Username field - $out .= Xml::checkLabel( wfMsg('activeusers-hidebots'), 'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ) ); + $out .= Xml::checkLabel( $this->msg( 'activeusers-hidebots' )->text(), + 'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ) ); - $out .= Xml::checkLabel( wfMsg('activeusers-hidesysops'), 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '
'; + $out .= Xml::checkLabel( $this->msg( 'activeusers-hidesysops' )->text(), + 'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ) ) . '
'; - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n";# Submit button and form bottom + $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "\n";# Submit button and form bottom $out .= Xml::closeElement( 'fieldset' ); $out .= Xml::closeElement( 'form' ); @@ -189,25 +188,25 @@ class SpecialActiveUsers extends SpecialPage { $this->setHeaders(); $this->outputHeader(); + $out = $this->getOutput(); + $out->wrapWikiMsg( "
\n$1\n
", + array( 'activeusers-intro', $this->getLang()->formatNum( $wgActiveUserDays ) ) ); + $up = new ActiveUsersPager( $this->getContext() ); # getBody() first to check, if empty $usersbody = $up->getBody(); - $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $this->getLang()->formatNum( $wgActiveUserDays ) ) - ); - - $s .= $up->getPageHeader(); - if( $usersbody ) { - $s .= $up->getNavigationBar(); - $s .= Html::rawElement( 'ul', array(), $usersbody ); - $s .= $up->getNavigationBar(); + $out->addHTML( $up->getPageHeader() ); + if ( $usersbody ) { + $out->addHTML( + $up->getNavigationBar() . + Html::rawElement( 'ul', array(), $usersbody ) . + $up->getNavigationBar() + ); } else { - $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) ); + $out->addWikiMsg( 'activeusers-noresult' ); } - - $this->getOutput()->addHTML( $s ); } } -- 2.20.1